'''
@Company: TWL
@Author: xue jian
@Email: xuejian@kanzhun.com
@Date: 2020-07-18 16:50:16
'''

import os
import sys
import json
sys.path.append(os.path.abspath(os.path.join(os.path.dirname('__file__'), os.path.pardir)))

import thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from hulk_proxy.HulkProxyServ import Client
from scan_data.ttypes import ScanData

__HOST = "172.21.32.54"
__PORT = 10088

try:
    tsocket = TSocket.TSocket(__HOST, __PORT)
    transport = TTransport.TFramedTransport(tsocket)
    protocol = TBinaryProtocol.TBinaryProtocol(transport)
    client = Client(protocol)

    transport.open()
    '''
    @note: read model names
    '''
    fea_slot_str = client.hget('feature_meta', 'feature_slot')
    fea_slot = json.loads(fea_slot_str)
    fea_code_map_str = client.hget('feature_meta', 'feature_code')
    fea_code_map = json.loads(fea_code_map_str)
    fea_code_tmp = client.hget('feature_meta', 'fea_code_map')
    fea_code_tmp = json.loads(fea_code_tmp)
    fea_code = {}
    for k, v in fea_code_map['geek_features'].items():
        fea_code[v] = k
    for k, v in fea_code_map['boss_features'].items():
        fea_code[v] = k
    for k, v in fea_code_map['crossing_features'].items():
        fea_code[v] = k
    for k, v in fea_code_tmp.items():
        fea_code[k] = v['code']
    

    for k, v in fea_slot.items():
        if k not in fea_code:
            print(k)
    
    


    transport.close()
except thrift.Thrift.TException as ex:
    print(ex.message)